import { messages } from "share/common";
import React, { Component } from "react";
import { Button, Checkbox, Menu, Dropdown, Icon } from "antd";

class RowCardFooter extends Component {
  render() {
    const {
      footer,
      onStart,
      startText,
      onForbid,
      forbidText,
      onDelete,
      deleteText,
      indeterminate,
      checkAll,
      onAllChange,
      checkedList,
      deleteButtonProps = {},
      forbidButtonProps = {},
      startButtonProps = {},
    } = this.props;
    return (
      <div className="row-card-footer">
        <div className="footer-check">
          <Checkbox onChange={onAllChange} indeterminate={indeterminate} checked={checkAll}>
            {messages("common-1.key3") /*全选*/}
          </Checkbox>
          <span>{messages("common-1.key1405", { arg1: Number(checkedList.length) }) /*已选择{arg1}条*/}</span>
        </div>
        {!footer ? (
          <div>
            {onStart && (
              <Button onClick={onStart} {...startButtonProps} disabled={!checkedList.length}>
                {startText || messages("common.status.enable") /*启用*/}
              </Button>
            )}
            {onForbid && (
              <Button onClick={onForbid} {...forbidButtonProps} disabled={!checkedList.length}>
                {forbidText || messages("common.status.disable") /*禁用*/}
              </Button>
            )}
            {onDelete && (
              <Button onClick={onDelete} {...deleteButtonProps} disabled={!checkedList.length}>
                {deleteText || messages("common.delete") /*删除*/}
              </Button>
            )}
          </div>
        ) : (
          footer
        )}
      </div>
    );
  }
}

export default RowCardFooter;
